use std::io::Cursor;

use rodio::Sink;

pub struct AudioSource {
    source: Cursor<Vec<u8>>,
    sink: Option<Sink>,
}

impl AudioSource {
    
    pub fn new(source: Cursor<Vec<u8>>) -> Self {
        Self { source, sink: None }
    }

    pub fn play(&self) {
        if let Some(sink) = &self.sink {
            sink.play();
        }
    }

    pub fn pause(&self) {
        if let Some(sink) = &self.sink {
            sink.pause();
        }
    }
}
